package com.example.shiro.common;


import com.example.shiro.common.response.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

/**
 * @auther 严旭平
 * @date 2020/4/819:02
 * @Description
 */
@RestController
@RequestMapping("test/")
@Api(tags = {"swagger测试操作接口"}, description = "swaggerTestController")
public class SwaggerTestController {

    @GetMapping("/{id}")
    @ApiOperation("测试restful从地址上地区数据")
    @ApiImplicitParam(name = "id", value = "用户ID", required = true, dataType = "Long", paramType = "path")
    public R getList(@PathVariable("id") Long id) {
        return R.ok().data("id", id);
    }

    @ApiOperation(value = "测试以键值对的方式从地址上取参数", notes = "根据用户ID查询用户")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "paramer1", value = "查询参数1", required = true, dataType = "Integer", paramType = "query"),
            @ApiImplicitParam(name = "paramer2", value = "查询参数2", required = false, dataType = "string", paramType = "query")
    })
    @PostMapping("/getList")
    public R selectById(@RequestParam(value = "paramer1", required = true, defaultValue = "1") Integer paramer1
            , @RequestParam(value = "paramer2", required = false) String paramer2) {
        return R.ok();
    }


}
